#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
class QActionGroup;
class QVBoxLayout;
class QFormLayout;
class QSlider;

class ViewDocuments;
class ToolsWidget;
class State;
class Tool;
class ToolCategory;
class Document;

namespace Ui {
class MainWindow;
}

class DrawingViewContainer;

class MainWindow : public QMainWindow
{
    Q_OBJECT
    friend class Application;
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
protected:
    void wheelEvent(QWheelEvent* pEvent);

private:
    void initMainWindowProperties();
    void initUndoRedo();
    void initMenus();
    void initMainToolbar();
    void initToolsWidgets();
    void initDocumentsView();
    void initDrawingViewContainer();
    void initStatusBar();

    Ui::MainWindow *ui;
    QPointer<DrawingViewContainer> m_drawingViewContainer;
    QPointer<ViewDocuments> m_viewDocuments;
    QPointer<ToolsWidget> m_toolsWidget;
    QPointer<QActionGroup> m_toolActionGroup;
    QPointer<QVBoxLayout> m_toolsLayout;

    QPointer<QSlider> m_zoomSlider;

    QPointer<QAction> m_undoAction;
    QPointer<QAction> m_redoAction;
private slots:
    void on_actionNew_triggered();
    void on_actionClose_triggered();

    void onToolCategoryAdded(QPointer<ToolCategory> toolCategory);
    void onToolAdded(QPointer<Tool> tool);
    void onToolActionTriggered();
    void updateWidgetsDependentOfDocumentExistion(QPointer<Document> doc);

    void onCloseDocument(QPointer<Document> doc);
signals:
    void toolChanged(QPointer<State> tool);
};

#endif // MAINWINDOW_H
